/*    */ package com.chw.utils;
/*    */ 
/*    */ import java.io.FileInputStream;
/*    */ import java.io.IOException;
/*    */ import java.util.Properties;
/*    */ import org.springframework.core.io.ClassPathResource;
/*    */ import org.springframework.core.io.Resource;
/*    */ import org.springframework.core.io.support.PropertiesLoaderUtils;
/*    */ 
/*    */ public class PropertyUtil
/*    */ {
/* 13 */   private static Properties configBundle = new Properties();
/*    */ 
/*    */   public PropertyUtil(String propertyName, String propertyUrl)
/*    */   {
/*    */     try {
/* 18 */       FileInputStream urlInputStream = new FileInputStream(propertyUrl + propertyName);
/* 19 */       configBundle.load(urlInputStream);
/*    */     } catch (Exception e) {
/* 21 */       e.printStackTrace();
/*    */     }
/*    */   }
/*    */ 
/*    */   public static String GetKeyValue(String key)
/*    */   {
/* 32 */     String value = null;
/*    */     try {
/* 34 */       value = configBundle.getProperty(key);
/*    */     } catch (Exception e) {
/* 36 */       return null;
/*    */     }
/* 38 */     return value;
/*    */   }
/*    */ 
/*    */   public static String getProperty(String propertiesName, String key) throws IOException {
/* 42 */     Resource resource = new ClassPathResource(propertiesName);
/* 43 */     Properties properties = PropertiesLoaderUtils.loadProperties(resource);
/* 44 */     return properties.getProperty(key);
/*    */   }
/*    */ }
